package com.danmu.nio;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class NIOSocketTest01 {
    //第三方弹幕协议服务器地址
    private static final String hostName = "openbarrage.douyutv.com";
    //第三方弹幕协议服务器端口
    private static final int port = 8601;

    public static void main(String[] args) throws Exception{
        //线程数
        int worker_num = 1;
        //获取弹幕服务器访问host
        String serverIp = InetAddress.getByName(hostName).getHostAddress();

        //线程池
        ExecutorService threadPool = Executors.newFixedThreadPool(worker_num);
        for (int n = 0; n < worker_num; n++) {
            NIOSocketClient client=new NIOSocketClient(serverIp,port);
            threadPool.execute(client);
        }
    }
}